let fs = require("fs");

let startTime  = new Date().getTime();
for (let i = 1; i < 100; i++){
    fs.writeFileSync("./a.txt","nodenode",{flag:"a"});  
}
let endTime = new Date().getTime();
console.log("同步耗时："+(endTime-startTime));




let bstarttime = new Date().getTime();
let num=0;
for (let j = 0; j < 100; j++) {
    fs.writeFile("./b.txt","222",{flag:"a"},function (err) {    
        num++;
        if (num==100) {
            let bendtime = new Date().getTime();
            console.log("异步耗时："+(bendtime - bstarttime));
        }
    })
    
}
